package com.example.coffeejava.Service.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.coffeejava.Dto.PageResult;
import com.example.coffeejava.Entity.Admin;
import com.example.coffeejava.Entity.Type;
import com.example.coffeejava.Mapper.AdminMapper;
import com.example.coffeejava.Mapper.TypeMapper;
import com.example.coffeejava.Service.AdminService;
import com.example.coffeejava.Service.TypeService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
@Service
public class TypeServiceImpl    extends ServiceImpl<TypeMapper, Type> implements TypeService {
    @Resource
    private TypeMapper typeMapper;
    public PageResult getlist(Integer pageNum, Integer pageSize, String keyword){

        PageHelper.startPage(pageNum,pageSize);
        Page<Type> page=typeMapper.getlist(keyword);
        PageResult pageResult=new PageResult();
        pageResult.setRecords(page.getResult());
        pageResult.setTotal((int) page.getTotal());
        return pageResult;
    }
}
